package com.service.setting.impl;

import com.comm.R;
import com.entity.PrescriptionCost;
import com.mapper.setting.SysPrescriptionMapper;
import com.service.setting.SysPrescriptionService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class SysPrescriptionServiceimpl implements SysPrescriptionService {
    @Autowired
    private SysPrescriptionMapper sysPrescriptionMapper;
    @Override
    public R fundPrescriptions() {
        R r = new R();
        try {
            //如果查询成功则，不会抛出异常则走这里
            List<PrescriptionCost> prescriptionCosts = sysPrescriptionMapper.fundPrescriptions();

            r.setCode(200);
            r.setMsg("恭喜你查到了");
            r.setData(prescriptionCosts);
            return r;

        }catch (Exception e){
            e.printStackTrace();
//            如果发生异常返回r对象
            r.setCode(500);
            r.setMsg("服务器开小差了");
            return r;
        }
    }
}
